#pragma once
#include <vulkan/vulkan_raii.hpp>
#include "Core/Context/LumineContext.hpp"
#include "Scene/Mesh.hpp"
namespace Lumine
{
    /// @brief 用于组装渲染管线
    class LuminePipeline
    {
    private:
        // RAII 对象
        vk::raii::Pipeline m_pipeline = nullptr;
        vk::raii::PipelineLayout m_layout = nullptr;
        vk::raii::DescriptorSetLayout descriptorSetLayout = nullptr;

        // 结构体
        vk::GraphicsPipelineCreateInfo pipelineInfo;
        
        void createDescriptorSetLayout();
        void CreatePipeline_Internal(vk::Format format);
        std::vector<char> readFile(const std::string &filename);
        vk::raii::ShaderModule createShaderModule(const std::vector<char> &code);
    public:
        LuminePipeline() {}

        vk::raii::Pipeline GetPipeline(vk::Format format)
        {
            CreatePipeline_Internal(format);
            return std::move(m_pipeline);
        }

        const vk::raii::DescriptorSetLayout & DescriptorSetLayout() const {
            return descriptorSetLayout;
        }

        const vk::raii::PipelineLayout & PipelineLayout() const {
            return m_layout;
        }
    };
}